package com.aaa.mrcai.service.impl;

import com.aaa.mrcai.mapper.SellerMapper;
import com.aaa.mrcai.pojo.entity.BusinessCheckInfo;
import com.aaa.mrcai.pojo.entity.StoreState;
import com.aaa.mrcai.pojo.vo.SellerVO;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.SellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author meowyf
 * @version 1.0
 * @Name Z_MJ
 * @date 2021/12/09 14:20:18
 */
@Service
public class SellerServiceImpl implements SellerService {
    @Autowired
    private SellerMapper sellerMapper;

    @Override
    public AjaxResult list(int uid) {
        BusinessCheckInfo list = sellerMapper.list(uid);
        System.out.println("aaaaaaaaaa"+list);
        return AjaxResult.success(list);
    }

    @Override
    public AjaxResult listState() {
        List<StoreState> stateList = sellerMapper.listState();
        /*System.out.println("dddddddddddddd"+stateList);*/
        return AjaxResult.success(stateList);
    }

    @Override
    public AjaxResult updateSeller(SellerVO sellerVO) {

        System.out.println("qqqqqqqqqqqq"+sellerVO);
        Integer s = sellerMapper.state(sellerVO);
        System.out.println(s);
        if (s == 1){
            return AjaxResult.defeated("停业整顿中，不可修改状态");
        }
        int i =sellerMapper.updateSellerONE(sellerVO);
        if (i>0){
            return AjaxResult.success();
        }
        return AjaxResult.defeated();
    }
}
